package gfiber

import (
	"goweb/examples/gfiber/gmiddleware"
	"log"

	"github.com/gofiber/fiber/v2"
)

var app *fiber.App

// 初始化 fiber
// 文档连接: https://docs.gofiber.io/
func init() {
	a := fiber.New(fiber.Config{
		Prefork:               true,
		CaseSensitive:         true,
		StrictRouting:         true,
		ServerHeader:          "Fiber",
		AppName:               "Test App v1.0.1",
		DisableStartupMessage: false,
	})

	app = a
}

func main_fiber() {

	// 使用 Log 中间件
	app.Use(gmiddleware.Logger())
	// 跨域配置
	app.Use(gmiddleware.Cors())

	app.Use(gmiddleware.Auth())

	// gfiber.GroupTest(app)
	BodyParserTest(app)
	log.Fatal(app.Listen("127.0.0.1:3000"))
}
